﻿using NexC_Sharp.Services;
using System.ComponentModel;
using System.Windows.Controls;

namespace RobotPerCeption.Entity
{
    public class RoboteConnect : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;
        public string ports { set; get; }

        public string ipaddress { set; get; }

        public bool connectTag { set; get; }



        public RoboteConnect(string ip, string port)
        {
            this.ports = port;

            this.ipaddress = port;


        }


        public bool hasConnect(Button btn, bool connectTag, Label label, string roboteName)
        {

            if (connectTag)
            {

                btn.Content = "断开";
                label.Content = "已连接";

                return true;
            }
            if (!connectTag)
            {
                Nex.disconnect_robot(roboteName);
            }

            label.Content = "未连接";
            btn.Content = "未连接";
            return false;
        }


    }
}
